<template>
  <div class="home middle clearfloat">
    <div class="user-info fl">
      <el-avatar :size="80" :src="baseUrl + '/storage/upload/' + $store.state.user.img" fit='contain'></el-avatar>
       <!-- 判断是否显示VIP图标 -->
      <div class='info-vip' v-if="$store.state.user.vip !=0">
      </div>
      <div class="info-welcome">
        <span>欢迎&emsp;</span>
        <span v-if="this.$store.state.user.name">{{$store.state.user.name}}</span>
        <span v-else>{{$store.state.user.nickname}}</span>
      </div>
      <!-- 会员等级 -->
      <div :class="userGradClass">
        </div>
    </div>
    <div class="user-content fr">
      <nuxt-child></nuxt-child>
    </div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      baseUrl: global.baseurl,
    }
  },
  computed: {
    userGradClass () {
      if (this.$store.state.user.vip) {
        switch(this.$store.state.user.vip) {
          case 1:   
            return 'grade-level copper';
          case 2:
            return 'grade-level silver';
          case 3:
            return 'grade-level gold';
          case 4:
            return 'grade-level drill';
        }
      } else {
        return ''
      }
    }
  },
  created () {
    // console.log(this.$store.state.user)
  },
  methods: {
    
  }
}
</script>

<style lang='less'>
  .home {
    margin-top: 19px;
    height: 660px;
    .user-info {
      width: 304px;
      height: 100%;
      background:linear-gradient(0deg,rgba(85,173,255,1) 0%,rgba(182,215,255,1) 100%);

      .el-avatar {
        margin: 74px auto 0;
        display: block;
      }
      .info-vip {
        height: 28px;
        width: 29px;
        margin: 10px auto;
        background:url('../../assets/img/图标.png') no-repeat;
        background-position:-94px -32px;
      }
      .upgradeVIP {
        padding: 7px 24px 7px 23px;
        background: #0090ff;
        display: block;
        margin: 10px auto 0;
        border-radius: 0px;
      }
      .info-welcome {
        margin: 16px auto 0;
        text-align: center;
        height:20px;
        font-size:18px;
        font-family:Source Han Sans CN;
        font-weight:400;
        color:rgba(27,27,27,1);
        line-height:24px;
      }
      .info-rate {
        width: 320px;
        margin: 40px auto 0;
        .rate-itme {
          margin-bottom: 16px;
        }
        .rate-itme:last-child {
          margin-bottom: 0px;
        }
        .rate-lable {
          font-size:15px;
          font-weight:300;
          color:rgba(255,255,255,1);
          font-family:Source Han Sans CN;

        }
        .el-rate {
          display: inline-block;
          margin-left: 22px;
          .el-rate__item {
            .el-rate__icon {
              margin-right: 14px;
              font-size:  24px;
              background: linear-gradient(0deg,#fddfaf 0%,#fcc752 100%);
              -webkit-background-clip: text;
              color: transparent !important;
            }
            .el-icon-star-on {
              background: linear-gradient(0deg,#fddfaf 0%,#fcc752 100%);
              -webkit-background-clip: text;
              color: transparent !important;
            }
            .el-rate__decimal {
              background: linear-gradient(0deg,#fddfaf 0%,#fcc752 100%);
              -webkit-background-clip: text;
              color: transparent !important;
            }
            .disabled {
              color: #b5c9cb !important;
            }
          }
          .el-rate__text {
            font-size:25px;
            color:rgba(254,177,3,1) !important;
            font-weight:800;
            font-family:Source Han Sans CN;
            margin-left: 5px;
            // font-style: oblique;
          }
          
          
        }
        
      }
      .grade-level {
        width: 158px;
        height: 120px;
        margin: 289px auto 0;
        background:url('../../assets/img/图标.png') no-repeat;
      }
      .copper {
        background-position:-345px -22px;
      }
      .silver {
        background-position:-345px -147px;
      }
      .gold {
        background-position:-517px -18px;
      }
      .drill {
        background-position:-517px -149px;
      }
    }
    .user-content {
      height: 100%;
      width: 543px;
    }
  }
</style>